project(ImGui)

set(imgui_src
"./imconfig.h"
"./imgui.h"
"./imgui.cpp"
"./imgui_draw.cpp"
"./imgui_internal.h"
"./imgui_tables.cpp"
"./imgui_widgets.cpp"
"./imgui_demo.cpp"
"./misc/freetype/imgui_freetype.h"
"./misc/freetype/imgui_freetype.cpp"
)

set(imgui_sdl3_ext
"./backends/imgui_impl_sdl3.h"
"./backends/imgui_impl_sdl3.cpp"
"./backends/imgui_impl_sdlrenderer3.h"
"./backends/imgui_impl_sdlrenderer3.cpp"
)

set(imgui_glfw_opengl_ext
"./backends/imgui_impl_opengl3.h"
"./backends/imgui_impl_opengl3.cpp"
"./backends/imgui_impl_opengl3_loader.h"
"./backends/imgui_impl_glfw.h"
"./backends/imgui_impl_glfw.cpp"
)

set(imgui_glfw_dx12_ext
"./backends/imgui_impl_dx12.h"
"./backends/imgui_impl_dx12.cpp"
"./backends/imgui_impl_glfw.h"
"./backends/imgui_impl_glfw.cpp"
)

set(imgui_win32_dx12_ext
"./backends/imgui_impl_dx12.h"
"./backends/imgui_impl_dx12.cpp"
"./backends/imgui_impl_win32.h"
"./backends/imgui_impl_win32.cpp"
)

set(imgui_glfw_vulkan_ext
"./backends/imgui_impl_vulkan.cpp"
"./backends/imgui_impl_vulkan.h"
"./backends/imgui_impl_glfw.cpp"
"./backends/imgui_impl_glfw.h"
)

if(TARGET SDL3-static)
    add_library(ImGui_SDL STATIC ${imgui_src} ${imgui_sdl3_ext})
    target_link_libraries(ImGui_SDL PRIVATE SDL3-static)
    target_include_directories(ImGui_SDL PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/backends")
endif()

add_library(ImGui_GLFW_DX12 STATIC ${imgui_src} ${imgui_glfw_dx12_ext})
target_link_libraries(ImGui_GLFW_DX12 PRIVATE glfw freetype)
target_include_directories(ImGui_GLFW_DX12 PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/backends")

add_library(ImGui_GLFW_VK STATIC ${imgui_src} ${imgui_glfw_vulkan_ext})
target_link_libraries(ImGui_GLFW_VK PRIVATE glfw freetype)
target_include_directories(ImGui_GLFW_VK PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/backends")
